package sctu.edu.java.year2016.team05.wangliwei.day20160519.chapter4_3;

/**
 * 使用while 循环语句计算1+1/2!+1/3！···1/20！
 */
public class _while {
    public static void main(String[] args) {
        int i=1,j=1;
        double sum = 0,temp = 1;
        while(i<=20){
            j=i;
            temp=1;
            while(j>1){
                temp*=j;
                j--;
            }
            sum+=(1/temp);
            i++;
        }
        System.out.println("1+1/2!+1/3！···1/20！="+sum);
    }

}

